﻿using System;
using System.Collections.Generic;
using System.Text;

namespace LibExtend
{
    public class Events
    {
        public enum ObjectName 
        {
            MergeItem, Catalog,Units,Price,History,Review,Current,
            DataSource, Grid, SummaryMerge, UpdateSummary,mmo,
            Print, New, Update, Delete, PrintMix, None
        }
        public enum ActionType
        {
            Clicked, MoveTable, GroupTable, UnGroup, Get, Changed, None
        }
        /// <summary>
        /// Move - merge - option
        /// </summary>
        public class mmo
        {
            /// <summary>
            /// MoveType : 1 - Move/split table. 2 - Merge table
            /// </summary>
            public int MoveType { get; set; }
            /// <summary>
            /// MergerOption : 1 - Merge bill but keep table.  2 - Merge bill and merge table
            /// </summary>
            public int MergeOption { get; set; }
            /// <summary>
            /// MenuOption : 1 - All menu.  2 - Menu selection
            /// </summary>
            public int MenuOption { get; set; }
            public System.Data.DataTable DataSource { get; set; }
        }

        public class Sender
        {
            /// <summary>
            /// Cancel action
            /// </summary>
            public bool Cancel { get; set; }
            public ObjectName ObjectName { get; set; }
            public ActionType ActionType { get; set; }
            public Table Item { get; set; }
            /// <summary>
            /// Move - merge - option
            /// </summary>
            public mmo mmo { get; set; }
            /// <summary>
            /// For table moving or table merge cases
            /// </summary>
            public Table ToItem { get; set; }
            public string Error { get; set; }
            public object ObjectValue { get; set; }

            public Sender(ObjectName ObjName, ActionType MyType)
            {
                this.ObjectName = ObjName;
                this.ActionType = MyType;
            }
            public Sender(ObjectName ObjName, ActionType MyType, Table item)
            {
                this.ObjectName = ObjName;
                this.ActionType = MyType;
                this.Item = item;
            }
        }

        /// <summary>
        /// Data exchange between MainForm and DetailForm
        /// </summary>
        /// <param name="sender"></param>
        public delegate void DataExchangeHandler(Sender sender);
    }
}
